/*
   Project AwesOmeScript
   Copyright 2010 Domenico Gentner

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.hpp"
#include "ProjectPropertiesDialog.hpp"
#include "Helpers.hpp"


//////////////////////////////////////////////////////////////////////////
// Dialog for showing Projects properties
//////////////////////////////////////////////////////////////////////////
ProjectPropertiesDialog::ProjectPropertiesDialog(wxWindow* parent, const Project* p, const wxString& aodir)
: wxDialog(parent, wxID_ANY, _("Project properties"))
{
	// Create parent GridSizer
	wxGridSizer* gSizer = new wxGridSizer(1, 1, 5, 5);

	// Create Static Box as deco
	wxStaticBox* box = new wxStaticBox(this, wxID_ANY, _("Used values"));

	// Create Sizer
	wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer(box, wxVERTICAL);

	// Generate Scriptfilename
	wxFileName fn(aodir + wxT("/scripts/"), p->GetCommandName());
	fn.Normalize();

	// Create Widgets
	wxStaticText* lblCommand = new wxStaticText(this, wxID_ANY, _("Command:"));
	NoEditTextBox* txtCommand = new NoEditTextBox(this, wxID_ANY, p->GetCommandName() );
	wxStaticText* lblChatlink = new wxStaticText(this, wxID_ANY, _("Visible Chatlink:"));
	NoEditTextBox* txtChatlink = new NoEditTextBox(this, wxID_ANY, p->GetChatLinkName());
	wxStaticText* lblFilename = new wxStaticText(this, wxID_ANY, _("Projectfile:"));
	NoEditTextBox* txtFilename = new NoEditTextBox(this, wxID_ANY, p->GetFileName());
	wxStaticText* lblScriptfile = new wxStaticText(this, wxID_ANY, _("Scriptfile:"));
	NoEditTextBox* txtScriptfile = new NoEditTextBox(this, wxID_ANY, fn.GetFullPath());

	// Add widgets to sizers
	sbSizer->SetMinSize(200,200);
	sbSizer->Add(lblCommand, 0, wxEXPAND|wxALL, 2);
	sbSizer->Add(txtCommand, 0, wxEXPAND|wxALL|wxFIXED_MINSIZE, 2);
	sbSizer->Add(lblChatlink, 0, wxEXPAND|wxALL, 2);
	sbSizer->Add(txtChatlink, 0, wxEXPAND|wxALL|wxFIXED_MINSIZE, 2);
	sbSizer->Add(lblFilename, 0, wxEXPAND|wxALL, 2);
	sbSizer->Add(txtFilename, 0, wxEXPAND|wxALL|wxFIXED_MINSIZE, 2);
	sbSizer->Add(lblScriptfile, 0, wxEXPAND|wxALL, 2);
	sbSizer->Add(txtScriptfile, 0, wxEXPAND|wxALL|wxFIXED_MINSIZE, 2);

	// Add to Layout
	gSizer->Add( sbSizer, 1, wxALL|wxEXPAND|wxSHAPED, 5 );

	// Layout
	this->SetSizerAndFit(gSizer);
}